| 12345678910111213141516171819202122232425 |
- // app/api/branches/[branch]/[year]/months/route.js
- import { NextResponse } from "next/server";
- import { listMonths } from "@/lib/storage";
- export async function GET(request, { params }) {
- const { branch, year } = params;
- if (!branch || !year) {
- return NextResponse.json(
- { error: "branch oder year fehlt" },
- { status: 400 }
- );
- }
- try {
- const months = await listMonths(branch, year);
- return NextResponse.json({ branch, year, months });
- } catch (error) {
- console.error("[api/branches/[branch]/[year]/months] Fehler:", error);
- return NextResponse.json(
- { error: "Fehler beim Lesen der Monate" },
- { status: 500 }
- );
- }
- }
|